import type { RouteRecordRaw } from 'vue-router';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/pages/login/index.vue'),
    meta: {
      title: '可乐在线协作白板-立即登录',
    },
  },
  {
    path: '/workbench',
    name: 'workbench',
    component: () => import('@/pages/workbench/index.vue'),
    meta: {
      title: '可乐在线协作白板-工作台',
      requiresAuth: true,
    },
  },
  {
    path: '/board/:boardId',
    name: 'editor',
    component: () => import('@/pages/editor/index.vue'),
    meta: {
      title: '',
      requiresAuth: true,
    },
  },
  {
    path: '/setting-team',
    name: 'teamSetting',
    component: () => import('@/pages/teamSetting/index.vue'),
    meta: {
      title: '可乐在线协作白板-工作台',
      requiresAuth: true,
    },
  },
  {
    path: '/team-invite/:code',
    name: 'teamInvite',
    component: () => import('@/pages/common/invitePage.vue'),
    meta: {
      title: '可乐在线协作白板-团队邀请',
    },
  },
  {
    path: '/board-invite/:code',
    name: 'boardInvite',
    component: () => import('@/pages/common/invitePage.vue'),
    meta: {
      title: '可乐在线协作白板-白板邀请',
    },
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/pages/common/404.vue'),
    meta: {
      title: '此页面不存在哦~',
    },
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/pages/common/403.vue'),
    meta: {
      title: '您没有权限访问此页面哦~',
    },
  },
  {
    path: '/:catchAll(.*)', // 不识别的path自动匹配404
    redirect: '/404',
  },
];

export default routes;
